﻿<UserControl x:Class="DataVisualizationDemos.InvertedAxis"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:charting="clr-namespace:System.Windows.Controls.DataVisualization.Charting;assembly=System.Windows.Controls.DataVisualization.Toolkit"
    xmlns:local="clr-namespace:DataVisualizationDemos">
    <Grid>
        <Grid.Resources>
            <local:InverterConverter x:Key="InverterConverter"/>
        </Grid.Resources>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition/>
            <RowDefinition/>
        </Grid.RowDefinitions>

        <Grid
            Grid.Row="0"
            Margin="10">

            <charting:Chart
                Title="Default Behavior"
                FontSize="9">
                <charting:LineSeries
                    ItemsSource="{Binding}"
                    DependentValuePath="Place"
                    IndependentValuePath="Date"
                    Title="Book">
                    <charting:LineSeries.DataPointStyle>
                        <Style TargetType="charting:LineDataPoint">
                            <Setter Property="Background" Value="Maroon"/>
                        </Style>
                    </charting:LineSeries.DataPointStyle>
                    <charting:LineSeries.DependentRangeAxis>
                        <charting:LinearAxis
                            Orientation="Y"
                            Minimum="0.5"
                            Maximum="10.5"
                            Interval="1"
                            ShowGridLines="True"/>
                    </charting:LineSeries.DependentRangeAxis>
                </charting:LineSeries>
            </charting:Chart>

        </Grid>

        <Grid
            Grid.Row="1"
            Margin="10">

            <charting:Chart
                Title="... with InverterConverter"
                FontSize="9">
                <charting:LineSeries
                    ItemsSource="{Binding}"
                    DependentValueBinding="{Binding Place, Converter={StaticResource InverterConverter}}"
                    IndependentValuePath="Date"
                    Title="Book">
                    <charting:LineSeries.DataPointStyle>
                        <Style TargetType="charting:LineDataPoint">
                            <Setter Property="Background" Value="Maroon"/>
                        </Style>
                    </charting:LineSeries.DataPointStyle>
                    <charting:LineSeries.DependentRangeAxis>
                        <charting:LinearAxis
                            Orientation="Y"
                            Minimum="-10.5"
                            Maximum="-0.5"
                            Interval="1"
                            ShowGridLines="True"/>
                    </charting:LineSeries.DependentRangeAxis>
                </charting:LineSeries>
            </charting:Chart>

        </Grid>

        <Grid
            Grid.Row="2"
            Margin="10">

            <charting:Chart
                Title="... with StringFormat"
                FontSize="9">
                <charting:LineSeries
                    ItemsSource="{Binding}"
                    DependentValueBinding="{Binding Place, Converter={StaticResource InverterConverter}}"
                    IndependentValuePath="Date"
                    Title="Book">
                    <charting:LineSeries.DataPointStyle>
                        <Style TargetType="charting:LineDataPoint">
                            <Setter Property="Background" Value="Maroon"/>
                            <Setter Property="DependentValueStringFormat" Value="{}{0:0.#;0.#}"/>
                        </Style>
                    </charting:LineSeries.DataPointStyle>
                    <charting:LineSeries.DependentRangeAxis>
                        <charting:LinearAxis
                            Orientation="Y"
                            Minimum="-10.5"
                            Maximum="-0.5"
                            Interval="1"
                            ShowGridLines="True">
                            <charting:LinearAxis.AxisLabelStyle>
                                <Style TargetType="charting:AxisLabel">
                                    <Setter Property="StringFormat" Value="{}{0:0.#;0.#}"/>
                                </Style>
                            </charting:LinearAxis.AxisLabelStyle>
                        </charting:LinearAxis>
                    </charting:LineSeries.DependentRangeAxis>
                </charting:LineSeries>
            </charting:Chart>

        </Grid>

    </Grid>
</UserControl>
